//
//  UserModel.m
//  DriftDog
//
//  Created by rimi on 15/9/13.
//  Copyright (c) 2015年 廖马林. All rights reserved.
//

#import "UserModel.h"

@implementation UserModel

+ (UserModel *)sharedUserModel {
    
    /* 单例方法的时候 */
    static UserModel *model;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        model = [UserModelArchive unarchive];  // 如果没有归过档，返回的就是nil
        if (!model) {
            model = [[UserModel alloc] init];
            model.token = @"模拟器随意填";
        }
    });
    
    return model;
}

#pragma mark - getter

- (BOOL)needAutoLogin {

    BOOL needAutoLogin = [[[NSUserDefaults standardUserDefaults] objectForKey:@"AUTOLOGIN"] boolValue];
    return needAutoLogin;
}

@end
